<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>教学班管理</title>
    <!-- Bootstrap Styles-->
    <link href="../../css/bootstrap/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="../../css/font-awesome.css" rel="stylesheet" />
    <!-- Morris Chart Styles-->

    <!-- Custom Styles-->
    <link href="../../css/custom-styles.css" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <!-- TABLE STYLES-->
    <link href="../../js/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
</head>

<body>
<div id="wrapper">
    <nav class="navbar navbar-default top-navbar" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="tea_course_index.html">题库与考试</a>
        </div>

        <ul class="nav navbar-top-links navbar-right">

            <li class="dropdown">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                    <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                </a>
                <ul class="dropdown-menu dropdown-user">
                    <li>
                        <a href="../student/stu_person_index.html"><i class="fa fa-user fa-fw"></i> 个人中心</a>
                    </li>
                    <li class="divider"></li>
                    <li>
                        <a href="../../login.html"><i class="fa fa-sign-out fa-fw"></i> 退出登录</a>
                    </li>
                </ul>
                <!-- /.dropdown-user -->
            </li>
            <!-- /.dropdown -->
        </ul>

    </nav>
    <!--/. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">

                <li>
                    <a href="tea_course_index.html"><i class="fa fa-dashboard"></i> 课程管理</a>
                </li>
                <li>
                    <a class="active-menu" href="tea_class_index.html"><i class="fa fa-desktop"></i> 教学班管理</a>
                </li>
                <li>
                    <a href="tea_kpoint_index.html"><i class="fa fa-bar-chart-o"></i> 知识点管理</a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-qrcode"></i> 题库管理<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a href="tea_itbank_new_index.html">新建题库</a>
                        </li>
                        <li>
                            <a href="tea_itbank_defend_index.html">维护题库</a>
                        </li>
                        <li>
                            <a href="tea_itbank_browse_index.html">查看题库</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa-sitemap"></i> 试卷管理<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a href="tea_paper_new_index.html">创建试卷</a>
                        </li>
                        <li>
                            <a href="tea_paper_browse_index.html">查看试卷列表</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa-fw fa-file"></i> 考试管理<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a href="tea_test_new_index.html">创建考试</a>
                        </li>
                        <li>
                            <a href="tea_test_alter_index.html">修改考试设置</a>
                        </li>
                        <li>
                            <a href="tea_test_browse_index.html">查看考试情况</a>
                        </li>
                    </ul>
                </li>
            </ul>

        </div>

    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper">
        <div id="page-inner">
            <div class="row">
                <div class="col-md-12">
                    <h1 class="page-header">
                        新建考试
                        <a href="tea_paper_browse_index.html" role="button" ><div  style="display: inline;float: right;"><button type="button" class="btn btn-primary">查看试卷列表</button></div></a>

                    </h1>
                </div>

                <div class="row">

                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                设置相关信息完成考试的新建
                            </div>
                            <div class="form-horizontal">
                                <div class="control-label col-lg-0"></div>
                                <!-- 考试名称 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testName" class="col-sm-2 control-label">考试名称</label>
                                        <label>
                                            <input type="text" class="form-control" id="testName" placeholder="输入考试名称"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 课程教师名字 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testName" class="col-sm-2 control-label">课程教师名字</label>
                                        <label>
                                            <input type="text" class="form-control" id="courseTeacherName" placeholder="输入课程教师名字"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 考试试卷名称 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testPaperName" class="col-sm-2 control-label">考试试卷名称</label>
                                        <label>
                                            <input type="text" class="form-control" id="testPaperName" placeholder="输入考试试卷名称"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 考试日期 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testDate" class="col-sm-2 control-label">考试日期</label>
                                        <label>
                                            <input type="date" value="2018-06-02" class="form-control" id="testDate"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 考试开始时间 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testStartTime" class="col-sm-2 control-label">考试开始时间</label>
                                        <label>
                                            <input type="time" value="14:00" class="form-control" id="testStartTime"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 考试结束时间 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testFinishTime" class="col-sm-2 control-label">考试结束时间</label>
                                        <label>
                                            <input type="time" value="16:00" class="form-control" id="testFinishTime"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 考试地点 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testPlace" class="col-sm-2 control-label">考试地点</label>
                                        <label>
                                            <input type="text" class="form-control" id="testPlace" placeholder="输入考试地点"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 总共设置两个监考老师，参考数据库表 -->
                                <!-- 考试监考老师1 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testInvigilator1" class="col-sm-2 control-label">考试监考老师</label>
                                        <label>
                                            <input type="text" class="form-control" id="testInvigilator1" placeholder="输入考试监考老师"/>
                                        </label>
                                    </div>
                                </div>
                                <!-- 考试监考老师2 -->
                                <div class="col-lg-8 col-lg-offset-4">
                                    <div class="col-lg-14">
                                        <label for="testInvigilator2" class="col-sm-2 control-label">考试监考老师</label>
                                        <label>
                                            <input type="text" class="form-control" id="testInvigilator2" placeholder="输入考试监考老师"/>
                                        </label>
                                    </div>
                                </div>
                                <hr>
                                <div class="form-group" style="padding-top: 10px">
                                    <div class="col-lg-offset-8 col-lg-offset-5">
                                        <button type="submit" id="addTestBtn" class="btn btn-primary" style="width:180px;">
                                            提交
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /. ROW  -->

        </div>
        <!-- /. ROW  -->
    </div>
    <!-- /. PAGE INNER  -->

</div>

<!-- /. PAGE WRAPPER  -->
<!-- /. WRAPPER  -->
<!-- JS Scripts-->
<!-- jQuery Js -->
<script src="../../js/jquery-1.10.2.js"></script>
<!-- Bootstrap Js -->
<script src="../../js/bootstrap.min.js"></script>
<!-- Metis Menu Js -->
<script src="../../js/jquery.metisMenu.js"></script>
<!-- DATA TABLE SCRIPTS -->
<script src="../../js/dataTables/jquery.dataTables.js"></script>
<script src="../../js/dataTables/dataTables.bootstrap.js"></script>
<script src="../../js/jquerysession.js"></script>
<script>
    $(document).ready(function() {
        $('#dataTables-example').dataTable();
    });
</script>

<!-- 页面用户名校验 -->
<script>
    $(document).ready(function () {
        $('#dataTables-example').dataTable();

        if ($.session.get('userid') == null) {
            alert("请先登录！！！");
            window.location.href = '/login.html';
        } else {
            if ($.session.get('usertype') != 1) {
                alert("您没有访问这个页面的权限！！！");
                window.location.href = '/login.html';
            }
        }
    })
</script>
<!-- 获取页面参数进行考试的修改 -->
<script>
    $(function(){
        $('#paperForm').submit(function(event){
            event.preventDefault();
            //获取提交的参数
            var testName=$('#testName').val();
            var courseTeacherID=$('#courseTeacherID').val();
            var testDate=$('#testDate').val();
            var testStartTime=$('#testStartTime').val();
            var testEndTime=$('#testEndTime').val();
            var testPlace=$('#testPlace').val();
            var testInvigilator1=$('#testInvigilator1').val();
            var testInvigilator2=$('#testInvigilator2').val();
            var test=JSON.stringify({"name":testName,"courseteacherid":courseTeacherID,"examdate":testDate,"starttime":testStartTime,"finishtime":testEndTime,"place":testPlace,"invigilator1":testInvigilator1,"invigilator2":testInvigilator2});
            //通过json进行封装s
            console.log(test);

            //ajax传参
            $.ajax({
                type:"post",
                url:"/exam/add",
                data:test,
                contentType:"application/json",
                dataType:"json",
                success:function(data){
                    //显示后端的返回数据
                    console.dir(data);
                    if (data.data.msg != "success"){
                        alert(data.data.msg);
                        window.location.href="/pages/teacher/tea_class_index.html";
                    }
                },
                error:function(data){
                    alter("请及时联系管理员");
                }
            })
        })
    })
</script>
</body>

</html>